<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>新增页面</title>
		<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
	</head>
	<body>
		<form class="layui-form" action="">
			<div class="mainBox">
				<div class="main-container" id="main-container">
				</div>
			</div>
			<script type="text/html" id="tpl">
				<div class="main-container">
					<div class="layui-form-item">
						<div class="layui-input-block">
						发起人:{{ d.uname }}	手机号:{{ d.phone }}
						</div>
					</div>

					{{# layui.each(d.ques,function(index,item){ }}
					<ul>
						<li><pre>{{ index+1 }}. {{ item.title }}</pre></li>
						<li><pre>{{ item.option1 }}({{ item.opvalue1 }})分</pre></li>
						<li><pre>{{ item.option2 }}({{ item.opvalue2 }})分</pre></li>
						<li><pre>{{ item.option3 }}({{ item.opvalue3 }})分</pre></li>
						<li><pre>{{ item.option4 }}({{ item.opvalue4 }})分</pre></li>
						<li><pre>题目解析：{{ item.explaination }}</pre></li>
						<li>选择的是 {{ item.choice }}</li>
					</ul>

					{{# })  }}
				</div>
			</script>
			<div class="bottom">
				<div class="button-container">
					<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
						lay-filter="user-save">
						<i class="layui-icon layui-icon-ok"></i>
						提交
					</button>
					<button type="reset" class="pear-btn pear-btn-sm">
						<i class="layui-icon layui-icon-refresh"></i>
						重置
					</button>
				</div>
			</div>
		</form>
		<script src="../../../component/layui/layui.js"></script>
		<script src="../../../component/pear/pear.js"></script>
		<script>
			layui.use(['form', 'jquery','upload','laydate', 'laytpl'], function() {
				var n=1;
				let form = layui.form;
				let $ = layui.jquery;
				var survey = {};
				let laytpl = layui.laytpl;
				let id = window.sessionStorage.getItem("id");
				$.ajaxSetup({
					headers:{
						'Authorization':window.sessionStorage.getItem("token")
					}
				})
				$.get(window.BASEPATH + "survey/preview/" + id, function(res) {
					if (res.code != 0) {
						alert(res.msg);
						return;
					}
					console.log(res)
					survey = res.data;
					var getTpl = $('#tpl').html();
					laytpl(getTpl).render(survey, function(html) {
						$('#main-container').html(html);
					});
				});

			})
		</script>
		<script>
		</script>
	</body>
</html>
